package com.jrzh.mvc.convert.sys;

import org.springframework.stereotype.Component;

import com.jrzh.framework.base.convert.BaseConvertI;
import com.jrzh.common.exception.ProjectException;
import com.jrzh.mvc.model.sys.MessageChannelModel;
import com.jrzh.mvc.view.sys.MessageChannelView;
import com.jrzh.common.utils.ReflectUtils;

@Component("messageChannelConvert")
public class MessageChannelConvert implements BaseConvertI<MessageChannelModel, MessageChannelView> {

	@Override
	public MessageChannelModel addConvert(MessageChannelView view) throws ProjectException {
		MessageChannelModel model = new MessageChannelModel();
		ReflectUtils.copySameFieldToTarget(view, model);
		return model;
	}

	@Override
	public MessageChannelModel editConvert(MessageChannelView view, MessageChannelModel model) throws ProjectException {
		ReflectUtils.copySameFieldToTargetFilter(view, model, new String[]{"createBy", "createTime"});
		return model;
	}

	@Override
	public MessageChannelView convertToView(MessageChannelModel model) throws ProjectException {
		MessageChannelView view = new MessageChannelView();
		ReflectUtils.copySameFieldToTarget(model, view);
		return view;
	}

}
